import { Component } from '@angular/core';
import { IonicPage, NavController } from 'ionic-angular';
import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';

@IonicPage()
@Component({
  selector: 'photoswipe-demo',
  templateUrl: 'photoswipe-demo.html'
})
export class PhotoswipeDemoPage {

  imgObj = [];

  constructor(public navCtrl: NavController, private nativePageTransitions: NativePageTransitions) {}

  ionViewDidLoad() {
  	  let img0 = "https://tse1-mm.cn.bing.net/th?id=OIP.VEupAZpNmSdinZicw-oh-QHaEK&w=234&h=160&c=7&o=5&pid=1.7";
  	  let img1 = "https://tse1-mm.cn.bing.net/th?id=OIP._tzSIqdu9Ua3aGfnGBrzfAHaEK&w=300&h=168&c=7&o=5&pid=1.7";
  	  let img2 = "https://tse1-mm.cn.bing.net/th?id=OIP.7BuhSMPYLQqruILu8YFKKQHaH7&w=178&h=191&c=7&o=5&pid=1.7";
  	  let img3 = "https://tse4-mm.cn.bing.net/th?id=OIP.rfU4rTmf0ZhSLLgIULkw3QHaEo&w=251&h=160&c=7&o=5&pid=1.7";
  	  let img4 = "https://tse2-mm.cn.bing.net/th?id=OIP.ObjO3tFLmUPnnrMHpyZx5gHaFU&w=225&h=161&c=7&o=5&pid=1.7";
  	  let img5 = "https://tse3-mm.cn.bing.net/th?id=OIP.LR1EWcFdBaQdJoU7ZUDIDwHaGV&w=162&h=177&c=7&o=5&pid=1.7";

	  this.imgObj = [{
	    "src": img0,   //
	    "srcx": img0,  //
	    "height": 500, "width": 600,  
	    "text":"图片提示文字"
	  },{
	    "src": img1,   //
	    "srcx": img1,  //
	    "height": 500, "width": 600,  
	    "text":"图片提示文字"
	  },{
	    "src": img2,   //
	    "srcx": img2,  //
	    "height": 500, "width": 600,  
	    "text":"图片提示文字"
	  },{
	    "src": img3,   //
	    "srcx": img3,  //
	    "height": 500, "width": 600,  
	    "text":"图片提示文字"
	  },{
	    "src": img4,   //
	    "srcx": img4,  //
	    "height": 500, "width": 600,  
	    "text":"图片提示文字"
	  },{
	    "src": img5,   //
	    "srcx": img5,  //
	    "height": 500, "width": 600,  
	    "text":"图片提示文字"
	  },];
  }
  ionViewWillLeave() {

   let options: NativeTransitionOptions = {
      direction: 'right',
      duration: 400,
      slowdownfactor: -1,
      iosdelay: 50
     };

   this.nativePageTransitions.slide(options)
     .then(function(){})
     .catch(function(){});

  }

}
